//
//  NetFuel.m
//  carcareIOS
//
//  Created by ileo on 16/4/13.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "NetFuel.h"
#import "AIUserInfo.h"

@implementation NetFuel

+(NetFuel *)getFuelDefaultSettingInfo{
    return [__SELF request:@"/setting/getSwitchs" withParams:nil type:REQUEST_POST];
}

+(NetFuel *)setFuelDefaultSettingInfo:(NSDictionary *)info{
    return [__SELF request:@"/Oil/setNewOil" withParams:info type:REQUEST_POST];
}

+(NetFuel *)getFuelPricesWithProvice:(NSString *)provice city:(NSString *)city{
    return [__SELF request:@"/Oil/getNewOil" withParams:@{@"city":provice, @"commonCity":city} type:REQUEST_POST];
}

+(NetFuel *)getFuelRecordsWithMonth:(NSString *)month{
    return [__SELF request:@"/tank/fuelLogByMonth" withParams:@{@"date":month} type:REQUEST_POST];
}

+(NetFuel *)addNewFuelRecordWithInfo:(NSDictionary *)info{
    return [__SELF request:@"/tank/addFuelLog" withParams:info type:REQUEST_POST];
}

+(NetFuel *)updateFuelRecordWithInfo:(NSDictionary *)info{
    return [__SELF request:@"/tank/modifyFuelLog" withParams:info type:REQUEST_POST];
}

+(NetFuel *)delFuelRecordWithID:(NSInteger)fuelID{
    return [__SELF request:@"/tank/delFuelLog" withParams:@{@"id":@(fuelID)} type:REQUEST_POST];
}

+(NetFuel *)getRecentlyFuel{
    return [__SELF request:@"/tank/latestDate" withParams:nil type:REQUEST_POST];
}

+(NetFuel *)hadReadNewFuelRecordWithID:(NSInteger)fuelID{
    return [__SELF request:@"/tank/readFuelLog" withParams:@{@"id":@(fuelID)} type:REQUEST_POST];
}

-(NSDictionary *)requestCommonParams{
    if (![USERINFO.session isNotNil]) {
        return nil;
    }
    return @{@"userid":@(USERINFO.userID),@"session":USERINFO.session,@"imei":USERINFO.pastDevice, @"vehicleData":USERINFO.pastDevice};
}

@end
